﻿using System;
using System.Diagnostics;

namespace DotNet.Common
{
	/// <summary>
	/// 时间计数器
	/// </summary>
	static class TimeCounter
	{
        static Stopwatch m_watch = new Stopwatch();

		/// <summary>
		/// 时间计数器开始
		/// </summary>
		[Conditional("DEBUG")]
		public static void Start()
		{
			Debug.WriteLine("TimeCounter Start.");
            m_watch.Restart();
		}

		/// <summary>
		/// 时间计数器结束
		/// </summary>
		[Conditional("DEBUG")]
		public static void Stop()
		{
			m_watch.Stop();
            Debug.WriteLine(string.Format("TimeCounter Stop.ElapsedTime: {0}ms,ElapsedTicks:{1}.", m_watch.ElapsedMilliseconds, m_watch.ElapsedTicks));
		}
	}
}
